package utils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

/**
 * Created by lvjunxiong on 2019/4/3.
 */
public class SMSUtil {
    public static void main(String[] args) {
        String res = "{\"jtId\":\"4028f69f55304e0b01553279b6310042\",\"record\":{\"columnNames\":[\"bmId\",\"bmMc\",\"party_id\",\"userId\",\"userName\"],\"columnValues\":[\"40280a8168143d030168143d308f0000\",\"综合办公室\",\"374b8c0569d81da50169dbe64ead0000\",\"374b8c0569d81da50169dbe64f3a0001\",\"吕俊雄\"],\"columns\":{\"bmId\":\"40280a8168143d030168143d308f0000\",\"bmMc\":\"综合办公室\",\"party_id\":\"374b8c0569d81da50169dbe64ead0000\",\"userId\":\"374b8c0569d81da50169dbe64f3a0001\",\"userName\":\"吕俊雄\"}},\"party_id\":\"374b8c0569d81da50169dbe64ead0000\",\"bmId\":\"40280a8168143d030168143d308f0000\",\"userName\":\"吕俊雄\",\"userId\":\"374b8c0569d81da50169dbe64f3a0001\",\"bmMc\":\"综合办公室\",\"validate\":true}\n";
        JsonParser jp = new JsonParser();
        //将json字符串转化成json对象
        JsonObject jo = jp.parse(res).getAsJsonObject();
        //获取message对应的值
        String jtId = jo.get("jtId").getAsString();
        System.out.println("jtId：" + jtId);
        boolean validate = jo.get("validate").getAsBoolean();//是否成功
        System.out.println("validate：" + validate);
        String userName = jo.get("userName").getAsString();//姓名
        System.out.println("userName：" + userName);
        String party_id = jo.get("party_id").getAsString();//用户id
        System.out.println("party_id：" + party_id);
    }
}
